home *** CD-ROM | disk | FTP | other *** search
- <?php
- ////////////////////////////////////////////////////////////////////////////////
- // <!--Copyright (c) 2005 Pure Networks Inc. All rights reserved.-->
- ////////////////////////////////////////////////////////////////////////////////
- //
- // Build: 3.0.6121.0 (Stable)
- // $Revision: #3 $
- //
-
- $sNavLocation = "folders";
- $sNavPage = "details";
- $sLocation = "Shared Folders";
- require '_session_common.php';
-
- ///////////////////////////////////////////////////
- // Make sure that we have a valid share passed in.
- ///////////////////////////////////////////////////
- if (!isset($_GET['share']))
- {
- $errorOccurred = 200;
- log_activity("QS check", "failure", return_error_text(200, "", $arErrors));
- }
- else
- {
- $sShare = $_GET['share'];
- log_activity("image share", "info", $sShare);
- }
- ///////////////////////////////////////////////////
- // Make sure that we have a valid path passed in.
- ///////////////////////////////////////////////////
- if ($errorOccurred == 0)
- {
- if (!isset($_GET['path']))
- {
- $errorOccurred = 201;
- log_activity("QS check", "failure", return_error_text(201, "", $arErrors));
- }
- else
- {
- $sPath = urlDecodeString($_GET['path']);
- log_activity("image path", "info", $sPath);
- }
- }
- require '_folderutils.php';
- /////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // NOTE: we do several try catch blocks so we know exactly which function threw the exception. //
- /////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////
- // Let's try to see if we can open the share
- ///////////////////////////////////////////////////
- try
- {
- $nmSharedPlace = $nmNetworkLib->OpenShare($sShare);
- $sContainer = $nmSharedPlace->ShareName;
- $sUnc = $nmSharedPlace->Unc;
- }
- catch(Exception $ex)
- {
- log_activity("Attempting nmNetworkLib->OpenShare($sShare)", "exception", $ex->getMessage());
- gotoAbs('/error/305/return');
- exit();
- }
- ///////////////////////////////////////////////////
- // double check the access level and react
- ///////////////////////////////////////////////////
- try
- {
- $sAccessLevel = $nmSharedPlace->AccessLevel;
- }
- catch(Exception $ex)
- {
- log_activity("Attempting nmSharedPlace->AccessLevel", "exception", $ex->getMessage());
- gotoAbs('/error/305/return');
- exit();
- }
-
- switch ($sAccessLevel)
- {
- case 0:
- ///////////////////////////////////////////////////
- // Public share, show away.
- ///////////////////////////////////////////////////
- break;
- case 1:
- if (!$bLoggedIn)
- {
- ///////////////////////////////////////////////////
- // Private share and user is not logged in, go away.
- ///////////////////////////////////////////////////
- log_activity("private folder request without session", "error", return_error_text(308, "", $arErrors));
- gotoAbs('/login/308');
- exit();
- }
- break;
- case 2:
- ///////////////////////////////////////////////////
- // Restricted share, go away.
- ///////////////////////////////////////////////////
- log_activity("restricted share request", "error", return_error_text(310, "", $arErrors));
- gotoAbs('/login/310');
- exit();
- break;
- default:
- log_activity("Undefined share access level", "error", return_error_text(311, "", $arErrors));
- gotoAbs('/login/311');
- exit();
- }
-
- ///////////////////////////////////////////////////
- // Make sure that we have a valid fileName passed in.
- ///////////////////////////////////////////////////
- if ($errorOccurred == 0)
- {
- if (!isset($_GET['fileName']))
- {
- $errorOccurred = 202;
- log_activity("QS check", "failure", return_error_text(202, "", $arErrors));
- }
- else
- {
- $fileName = urlDecodeString($_GET['fileName']);
-
- // get the file arrays if needed
- $sPath = substr($sPath, 0, (strlen($sPath) - strlen($fileName) - 1));
- createSessionFileArrays($sShare, $sPath, $sPath, $nmSharedPlace, false, $_GET['page']);
- $arSharePath = $_SESSION['currentFolderInfo'];
- $arFiles = $_SESSION['currentFolderFiles'];
- //init variables
- $count = count($arFiles);
- $sWorkingPrev = "";
- $sFullFilePath = "";
- $sPrevFilePath = "";
- $sPrevFileName = "";
- $sNextFilePath = "";
- $sNextFileName = "";
- $bGetNext = false;
- $bShowNextPrev = false;
- if ($count > 1)
- {
- $bShowNextPrev = true;
- }
-
- $iFileCounter = 1;
- $sFirstFileName = "";
- $bBreak = true;
- foreach ($arFiles as $file)
- {
- // set the name of the very first file away in case we hit the end and want to next.
- if ($iFileCounter == 1)
- {
- $sFirstFileName = urlDecodeString($file[0]);
- }
-
- if ($bGetNext)
- {
- if ($bBreak)
- {
- $sNextFileName = urlDecodeString($file[0]);
- $bBreak = false;
- $bGetNext = false;
- }
- else
- {
- if ($iFileCounter == count($arFiles))
- {
- //we hit the end after finding the file, let's assign the last file to the prev
- $sPrevFileName = urlDecodeString($file[0]);
- }
-
- if ($iFileCounter == 2)
- {
- $sNextFileName = urlDecodeString($file[0]);
- }
- }
- }
- if (urlDecodeString($file[0]) == $fileName)
- {
- $sFullFilePath = $arSharePath[1] . "\\" . urlDecodeString($file[0]);
- $sPrevFileName = $sWorkingPrev;
-
- if ($iFileCounter == count($arFiles))
- {
- // we hit the end of the array, next is actually the beginning
- $sNextFileName = $sFirstFileName;
- }
- else
- {
- $bGetNext = true;
- }
-
- if ($iFileCounter == 1)
- {
- // we found our file and it's the first one in the array - show prev as last item
- $bBreak = false;
- }
- }
- $sWorkingPrev = urlDecodeString($file[0]);
- $iFileCounter++;
- }
- $sPrevFilePath = $arSharePath[1] . "\\" . $sPrevFileName;
- $sNextFilePath = $arSharePath[1] . "\\" . $sNextFileName;
- }
- }
-
- ///////////////////////////////////////////////////
- // Make sure that we have a valid fileNum passed in.
- ///////////////////////////////////////////////////
- if ($errorOccurred == 0)
- {
- if (!isset($_GET['fileNum']))
- {
- $errorOccurred = 202;
- log_activity("QS check", "failure", return_error_text(202, "", $arErrors));
- }
- else
- {
- $fileNum = intval($_GET['fileNum']);
- if ($fileNum > $count)
- {
- // if we have a number greater than the count, assume they tried to wrap around the end
- $fileNum = $count;
- }
- if ($fileNum < 1 )
- {
- // if we have a number less than 1, assume they tried to wrap around the start
- $fileNum = 1;
- }
- }
- }
- ///////////////////////////////////////////////////
- // make sure the file requested actually exists
- ///////////////////////////////////////////////////
- if (!file_exists($sFullFilePath))
- {
- log_activity("get file details", "error", return_error_text(342, "", $arErrors));
- gotoAbs('/error/342/return');
- }
-
- ///////////////////////////////////////////////////
- // start printing out the HTML to the browser
- ///////////////////////////////////////////////////
- require "_header.php";
- require "_cookie_util.php";
-
- $detailslink = "/filedetails/" . $sShare . "/" . urlEncodeString($sFullFilePath);
- $backlink = "/fileview/" . $sShare . "/" . urlEncodeString($sPrevFilePath)
- . "/" . urlEncodeString($sPrevFileName) . "&fileNum=" . ($fileNum - 1);
- $nextlink = "/fileview/" . $sShare . "/" . urlEncodeString($sNextFilePath)
- . "/" . urlEncodeString($sNextFileName) . "&fileNum=" . ($fileNum + 1);
-
- $iFileNamePos = strpos($sFullFilePath, strrchr($sFullFilePath, "\\"));
- $sFile = substr($sFullFilePath, $iFileNamePos+1);
- $sPathNoFile = substr($sFullFilePath, 0, (strlen($sFullFilePath) - strlen($sFile) - 1));
- $viewlink = "/fileopen/" . $sShare . "/" . urlEncodeString($sPathNoFile) . "/" . urlEncodeString($sFile);
- $folderlink = "/folderview/" . $sShare . "/" . urlEncodeString($sFullFilePath);
- $downloadlink = "/filesave/" . $sShare . "/" . urlEncodeString($sPathNoFile) . "/" . urlEncodeString($sFile);
- $detailsviewimage = "/detailsview/" . $sShare . "/" . urlEncodeString($sPathNoFile) . "/" . urlEncodeString($sFile);
-
- $bIsDir = (is_dir($sFullFilePath) && ($sFile != ".") && ($sFile != ".."));
-
- $sFileExtension = strtolower(strrchr($sFile, "."));
- $bSupportedExtension = true;
- if (isValidString($sFileExtension))
- {
- $bSupportedExtension = isSupportedDownloadExtension($sDownloadUnsupportedExtensions, $sFileExtension);
- }
- ?>
- <table cellspacing="0" cellpadding="0" border="0" width="100%">
- <tr>
- <td width="100%" valign="top">
- <?php require "_public_error_states.php"; ?>
- <!-- Start Folder view table -->
- <table cellspacing="0" cellpadding="0" border="0" class="ContentTable">
- <tr>
- <td class="ContentTableTL"><div> </div></td>
- <?php printBreadcrumbs($sShare, $sUnc, $sFullFilePath, $sContainer, $iBreadCrumbDetailsTruncateLength, $count, $ObjectsPerPage, ceil($fileNum/$ObjectsPerPage), true); ?>
- <td class="ContentTableTM3">
- <?php
- if ($bShowNextPrev)
- {
- ?>
- <table cellspacing="0" cellpadding="0" border="0" align="right" class="NextPrevButtonContain">
- <tr>
- <td><a href="<?php echo ($backlink); ?>"><span class="PrevPicture" title="Show Previous Item..." onMouseOver="this.className='PrevPictureOver'" onMouseOut="this.className='PrevPicture'"></span></a></td>
- <td><a href="<?php echo ($nextlink); ?>"><span class="NextPicture" title="Show Next Item..." onMouseOver="this.className='NextPictureOver'" onMouseOut="this.className='NextPicture'"></span></a></td>
- </tr>
- </table>
- <?php
- }
- else
- {
- echo (" ");
- }
- ?>
- </td>
- <td class="ContentTableTR"><div> </div></td>
- </tr>
- <tr>
- <td class="ContentTableML"><div> </div></td>
- <td class="ContentTableMM" colspan="3">
- <div class="ShareContents MidSizeImage" style="text-align:center;">
- <?php
- if (!$bIsDir)
- {
- if ($bSupportedExtension)
- {
- ?>
- <a href="<?php echo ($viewlink); ?>" target="_new">
- <img class="MidSizeImg<?php echo $imgMode; ?>" src="<?php echo ($detailsviewimage); ?>" alt="<?php echo(substr(strrchr($sFullFilePath,"\\"),1)); ?>" border=0/>
- </a>
- <?php
- }
- else
- {
- ?>
- <img class="MidSizeImg<?php echo $imgMode; ?>" src="<?php echo ($imgLocation); ?>" <?php if (isset($imageTag_width)) {echo ("width=\"" . $imageTag_width . "\"");} ?> <?php if (isset($imageTag_height)) {echo ("height=\"" . $imageTag_height . "\"");} ?> alt="<?php echo(substr(strrchr($sFullFilePath,"\\"),1)); ?>" border=0/>
- <?php
- }
- }
- else
- {
- ?>
- <div class="MidSizeImgFolder">
- <div>
- <div class="MidSizeImgFolderImage" onclick="location.href='<?php echo ($folderlink); ?>'"> </div>
- </div>
- </div>
- <br/><br/>
- <?php
- }
- ?>
- </div> <!--ShareContents-->
- </td>
- <td class="ContentTableMR"> </td>
- </tr>
- <tr>
- <td class="ContentTableBL"> </td>
- <td class="ContentTableBM" colspan="3"> </td>
- <td class="ContentTableBR"> </td>
- </tr>
- </table> <!-- End Folder View Table -->
- </td>
- <td valign="top">
- <?php
- ///////////////////////////////////////////////////
- // Define the tasks for this page
- ///////////////////////////////////////////////////
- $iTaskCount = 0;
- if ($arSharePath[3]) // this is the slideshow true or false information
- {
- $arTasks[$iTaskCount][0] = "View slideshow";
- $arTasks[$iTaskCount][1] = "javascript:openSlideshow('/slideshow/" . $sShare . "/" . urlEncodeString($sPathNoFile) . "/');";
- $arTasks[$iTaskCount][2] = "SlideshowLink";
- $arTasks[$iTaskCount][3] = "";
- $iTaskCount++;
- }
-
- ///////////////////////////////////////////////////
- // Force files with specific extensions to behave
- // specific ways regardless of requested action
- ///////////////////////////////////////////////////
- if ($bSupportedExtension)
- {
- if (!$bIsDir)
- {
- switch ($sFileExtension)
- {
- case ".exe":
- $arTasks[$iTaskCount][0] = "Open file";
- $arTasks[$iTaskCount][1] = $viewlink;
- $arTasks[$iTaskCount][2] = "OpenFileLink";
- $arTasks[$iTaskCount][3] = "_new";
- $iTaskCount++;
- break;
- default:
- $arTasks[$iTaskCount][0] = "Open file";
- $arTasks[$iTaskCount][1] = $viewlink;
- $arTasks[$iTaskCount][2] = "OpenFileLink";
- $arTasks[$iTaskCount][3] = "_new";
- $iTaskCount++;
- }
- $arTasks[$iTaskCount][0] = "Download file";
- $arTasks[$iTaskCount][1] = $downloadlink;
- $arTasks[$iTaskCount][2] = "SaveFileLink";
- $arTasks[$iTaskCount][3] = "_new";
- $iTaskCount++;
- }
- else
- {
- $arTasks[$iTaskCount][0] = "Open folder";
- $arTasks[$iTaskCount][1] = $folderlink;
- $arTasks[$iTaskCount][2] = "OpenFolderLink";
- $arTasks[$iTaskCount][3] = "";
- $iTaskCount++;
- }
- }
-
-
- $bLimitLocations = true;
- require "panels.php";
- ?>
-
- </td>
- </tr>
- </table>
- <script type="text/javascript">
- writePrepCookie();
- </script>
- <?php
- ///////////////////////////////////////////////////
- // Finish printing out the HTML to the browser
- ///////////////////////////////////////////////////
- require "_footer.php";
- ?>
-